package com.yan.furns.utils;

import org.apache.commons.beanutils.BeanUtils;

import java.util.Map;

/**
 * @author Yzb
 * @version 1.0
 */
public class DataUtils {
	public static <T> T copyParameterToBean(Map value, T bean) {
		try {
			BeanUtils.populate(bean, value);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bean;
	}

	public static Integer parseInt(String value, int defaultValue) {
		try {
			return Integer.parseInt(value);
		} catch (Exception e) {
//			System.out.println(value + "格式不正确");
			return defaultValue;
		}
	}
}
